package 剑指offer;

import java.util.Arrays;
import java.util.Comparator;

public class _45把数组排成最小的数 {
    public String minNumber(int[] nums) {
        String[] strings = new String[nums.length];
        for(int i = 0; i < nums.length; i++){
            strings[i] = String.valueOf(nums[i]);
        }
        Arrays.sort(strings, (x,y)->(x + y).compareTo(y + x));
        StringBuffer res = new StringBuffer();
        for(String s : strings){
            res.append(s);
        }
        return res.toString();
    }
}
